<?php
class ExamModel extends CI_Model{
    public function getExamsByDate(){
        $this->db->select ('examId, examCourse, startDate, endDate, examType');
        $this->db->from ('exams');
        $this->db->where("NOW() BETWEEN startDate AND endDate");
        $query = $this->db->get();
        $exams = $query->result();
        return $exams;
    }
    
    public function areSpecialExams(){
        $this->db->select ('examType');
        $this->db->from ('exams');
        $this->db->where("NOW() BETWEEN startDate AND endDate");
        $this->db->where(" (examType = 'parcial' OR examType = 'final' OR examType = 'rezagado') ", NULL, FALSE);
        $query = $this->db->get();
        $examTypes = $query->result();
        if(count($examTypes) > 0){
            return true;
        }else{
            return false;
        }
    }
    
}
